#pragma once
#include "mysqlPool.h"
class mysqlMgr
{
public:
	static mysqlMgr& GetInst();
	std::shared_ptr<UserInfo> GetUser(int uid);
	std::shared_ptr<UserInfo> GetUser(std::string name);
	int RegUser(const std::string& name, const std::string& email, const std::string& pwd);
	bool CheckEmail(const std::string& user, const std::string& email);
	bool UpdatePwd(const std::string& name, const std::string& pwd);
	bool AddFriendApply(const int& from, const int& to);
	bool GetApplyList(const int& uid, std::vector<std::shared_ptr<ApplyInfo>>& apply_list,int begin,int limit = 10);
	bool CheckPwd(const std::string& user, const std::string& pwd,UserInfo& userinfo);
	bool AuthFriendApply(const int& uid, const int& touid);
	bool GetFriendList(const int& self_uid, std::vector<std::shared_ptr<UserInfo>>& userinfo);
	bool AddFriend(const int& uid, const int& touid, const std::string& back_name);
private:
	mysqlMgr();
	mysqlDao _dao;
};

